# Maintainer:
pkgname=lua-language-server
pkgver=3.7.3
pkgrel=0
pkgdesc="Language Server for Lua"
url="https://github.com/LuaLS/lua-language-server"
# s390x/ppc64le: ftbfs
# 32-bit: not useful there
arch="all !x86 !armhf !armv7 !s390x !ppc64le"
license="MIT"
makedepends="bash linux-headers samurai"
source="https://github.com/LuaLS/lua-language-server/archive/refs/tags/$pkgver/lua-language-server-$pkgver.tar.gz
	lua-language-server-submodules-$pkgver.zip.noauto::https://github.com/LuaLS/lua-language-server/releases/download/$pkgver/lua-language-server-$pkgver-submodules.zip
	wrapper
	"
options="!check" # tests run in build

prepare() {
	unzip -o "$srcdir"/lua-language-server-submodules-$pkgver.zip.noauto \
		-d "$builddir"
	default_prepare
}

build() {
	ninja -C 3rd/luamake -f compile/ninja/linux.ninja
	./3rd/luamake/luamake rebuild
}

package() {
	install -Dm755 "$srcdir"/wrapper "$pkgdir"/usr/bin/lua-language-server
	install -Dm755 bin/lua-language-server \
		-t "$pkgdir"/usr/lib/lua-language-server/bin
	install -Dm644 bin/main.lua \
		-t "$pkgdir"/usr/lib/lua-language-server/bin
	install -Dm644 debugger.lua main.lua \
		-t "$pkgdir"/usr/lib/lua-language-server
	cp -a locale meta script "$pkgdir"/usr/lib/lua-language-server
}

sha512sums="
6497d66057733cf655abb451173bd4171247afbecced517f88861bd2f4202305cd2b8bdf10afd1d20d04eee9b22675490125ef6cc6e4056918c382d6f7ccdaee  lua-language-server-3.7.3.tar.gz
db59d2987b09bb90fcdc362294d7b28b1652613414970856b54343c2a6ec791744dd524e505cb1495c0014c37288a8f5f5a849c64391a3e1a716bbe6788adcf2  lua-language-server-submodules-3.7.3.zip.noauto
d8d34d2ae8073c256b5f98f4cc7db058fbb92d63a5709894fca898ab47fcfcfca2d1419a1060c29464fbad937e3d09f0cde404b4d98609eec934ea4392044849  wrapper
"
